package cn.tedu.submarine;

import javax.imageio.ImageReader;
import javax.swing.ImageIcon;

//战舰   对抗船
public class Battleship extends SeaObject{
    private int life;  //命
    //构造方法
    public Battleship(){
        super(66,26,270,124,20);
        life = 5;
    }

    @Override//重写mov
    public void move() {
    }

    //重写getImage()获取图片
   public ImageIcon getImage(){
        return Images.battleship;//返回战舰
   }

   /**战舰发射深水炸弹---生成深水炸弹对象*/
   public Bomb shoot(){
       return new Bomb(this.x,this.y);//深水炸弹的坐标和战舰坐标一致
   }


   /**战舰左移*/
   public void moveLeft(){
       x-=speed;//x-(左移)
   }
   /**战舰右移*/
   public void moveRight(){
       x+=speed;//x+(右移)
   }

   /**战舰增命*/
   public void addLift(int num){
       life+=num;//增命
   }

   /**获取命数*/
   public int getLife(){
       return life;//返回命数
   }

   /**战舰减命*/
   public void subtractLife(){life--;}


}

